<?php
/* @var $this AdminController */
/* @var $model Admin */

$this->breadcrumbs = array(
    '系统用户' => array('admin'),
    '列表',
);

$this->menu = array(
    array('label' => '系统用户', 'url' => array('admin'), 'items' => array(
        array('label' => '列表', 'url' => array('admin')),
        array('label' => '添加', 'url' => array('create')),
    )),
    array('label' => '系统分组', 'url' => array('role/admin'), 'items' => array(
        array('label' => '列表', 'url' => array('role/admin')),
        array('label' => '添加', 'url' => array('role/create')),
    )),
    array('label' => '系统权限', 'url' => array('roleSource/admin'), 'items' => array(
        array('label' => '列表', 'url' => array('roleSource/admin')),
        array('label' => '添加', 'url' => array('roleSource/create')),
    )),
    array('label' => '权限分配', 'url' => array('roleAcl/admin'), 'items' => array(
        array('label' => '管理', 'url' => array('roleAcl/admin')),
        array('label' => '分配', 'url' => array('roleAcl/create')),
    )),
    array('label' => '高级搜索', 'url' => array($this->createUrl('javascript:void(0)')), 'linkOptions' => array('class' => 'search-button'))
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('admin-grid', {
		data: $(this).serialize()
	});
	return false;
});
");
?>

<h1>系统用户</h1>

<div class="search-form" style="display:none">
    <?php
    $this->renderPartial('_search', array(
        'model' => $model,
    ));
    ?>
</div><!-- search-form -->

<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id' => 'admin-grid',
    'dataProvider' => $model->search(),
    'filter' => $model,
    'template' => '{items}{pager}',
    'columns' => array(
        array(
            'name' => 'role_id',
            'value' => 'Role::model()->findByPk($data->role_id)->role_name',
            'filter' => CHtml::listData(Role::model()->findAll(), 'id', 'role_name'),
        ),
        'user_name',
        'user_email',
        'display_name',
        array(
            'class' => 'CButtonColumn',
        ),
    ),
));
?>
